//
//  UserDefinedCellForWaringInformationOfWaringInformation.m
//  HondaPro_2
//
//  Created by Eric on 13-6-13.
//  Copyright (c) 2013年 glendale. All rights reserved.
//

#import "UserDefinedCellForWaringInformationOfWaringInformation.h"

@interface UserDefinedCellForWaringInformationOfWaringInformation ()

//创建自定义labels
-(void)initLabelsOnCell;

@end

@implementation UserDefinedCellForWaringInformationOfWaringInformation

@synthesize dicForLabelsOnCell = _dicForLabelsOnCell;
@synthesize arrForKeys = _arrForKeys;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        [self initLabelsOnCell];
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)initLabelsOnCell
{
    self.dicForLabelsOnCell = [NSMutableDictionary dictionaryWithCapacity:3];
    
    self.arrForKeys = [NSArray arrayWithObjects:
                       MM_WARING_INFORMATION_WARING_INFORMATION_LIST_WARING_INFORMATION_PART_CODE_KEY_STR_,
                       MM_WARING_INFORMATION_WARING_INFORMATION_LIST_WARING_INFORMATION_PART_NAME_KEY_STR_,
                       MM_WARING_INFORMATION_WARING_INFORMATION_LIST_WARING_INFORMATION_ADD_UP_REPAIR_QTY_KEY_STR_,nil];
    
    //给字典中 添加 3 个label，因为cell上有 3 项要显示
    
    for (int i = 0; i<3; i++)
    {
        UILabel *lbl = [[UILabel alloc] init];
        lbl.backgroundColor = [UIColor clearColor];
        lbl.font = [UIFont systemFontOfSize:13];
        lbl.numberOfLines = 2;
        lbl.textColor = [UIColor grayColor];
        [self.contentView addSubview:lbl];
        [self.dicForLabelsOnCell setValue:lbl forKey:[_arrForKeys objectAtIndex:i]];
    }
    
    ((UILabel *)[self.dicForLabelsOnCell objectForKey:MM_WARING_INFORMATION_WARING_INFORMATION_LIST_WARING_INFORMATION_PART_CODE_KEY_STR_]).frame =
    CGRectMake(0, 0, 160, 50);
    ((UILabel *)[self.dicForLabelsOnCell objectForKey:MM_WARING_INFORMATION_WARING_INFORMATION_LIST_WARING_INFORMATION_PART_NAME_KEY_STR_]).frame =
    CGRectMake(161, 0, 160, 50);
    ((UILabel *)[self.dicForLabelsOnCell objectForKey:MM_WARING_INFORMATION_WARING_INFORMATION_LIST_WARING_INFORMATION_ADD_UP_REPAIR_QTY_KEY_STR_]).frame =
    CGRectMake(322, 0, 600, 50);
}

@end
